// with polyfills
import 'core-js/stable'
import 'regenerator-runtime/runtime'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import { VueAxios } from './utils/request'
// WARNING: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.
import './mock'
import BaiduMap from 'vue-baidu-map'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'


import bootstrap from './core/bootstrap'
import './core/lazy_use'
import './permission' // permission control
import '@/utils/filter' // global filter
import './components/global.less'
import { Dialog } from '@/components'
import { hasBtnPermission } from '@/utils/permissions' // button permission
import { sysApplication } from '@/utils/applocation'
// 表单设计器 str
import KFormDesign from './components/k-form-design/packages'
import './components/k-form-design/static/styles/form-design.less'
import jm from 'vue-jsmind'
import bus from './assets/js/bus'
Vue.use(jm)
Vue.use(KFormDesign)
// 表单设计器 end
Vue.use(VueAxios)
Vue.use(ElementUI)

Vue.use(Dialog)
Vue.use(bus)
// var EventBus = new Vue();
//
// Object.defineProperties(Vue.prototype, {
//   $bus: {
//     get: function () {
//       return EventBus
//     }
//   }
// })
Vue.prototype.hasPerm = hasBtnPermission
Vue.prototype.applocation = sysApplication
Vue.prototype.randomNum = function (len) {
  const rangeArr = []
  for (let i = 0; i < len; i++) {
    rangeArr.push(parseInt(Math.random() * 9))
  }
  return rangeArr.join('')
}
Vue.config.productionTip = false
Vue.use(BaiduMap, {
  // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
  ak: 'RUwng5MMlg8KPGCSL50G1lLxUxYVliGm'
})

Vue.filter('imgPath', url => {
  return window.CONST.VUE_APP_API_BASE_FILE_URL + url
})

new Vue({
  router,
  store,
  created: bootstrap,
  render: h => h(App)
}).$mount('#app')
